package ceha.util;

import ceha.application.CEHAAdmin;
import ceha.application.CEHALogin;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JFrame;

public class Mysql {

    public JFrame ceha;
    private CEHAAdmin adminParam;
    private String message;

    public Mysql(CEHAAdmin adminparam) {
        this.adminParam = adminparam;
    }

    public Connection Connect() throws IOException {
        String url = "jdbc:mysql://localhost:3306/";
        String dbName = "ceha";
        String driver = "com.mysql.jdbc.Driver";
        String userName = "root";
        String password = "";
        Connection conn = null;
        try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url + dbName, userName, password);
        } catch (Exception e) {
//            e.printStackTrace();


            new OkDialog(adminParam," Démarrez la base Mysql ! ").setVisible(true);



        }
        return conn;
    }
}
